
$.ajaxSetup ({cache: false});//turn off ajax caching



function submitProfile(){

	$('#submitMsgDiv').html("");

	var isValid = true;
	var errorMsg = "";
	
	var server = $("input:radio[name=server]:checked").val();
	var profile = $("#profileInpt").val();

	if(profile.match(/[^A-Za-z0-9]+/) || profile.length<1){
		isValid = false;
		errorMsg+=" Invalid Profile ID ";
	}
	if(server==undefined){
		isValid = false;
		errorMsg+= " No Server Selected ";
	}

	if(!isValid){
		alert(errorMsg);
	}else{/*Call AJAX to check validity & insert record*/
		var dataString = "server="+server+"&profile="+profile;
		

		$.ajax({
			type: "GET",
			url: 'parse_url.php',
			data: "server=" + server + "&profile=" + profile,
			success: function(data) {
				$('#submitMsgDiv').html(data);
			}
		});

	}
}

function getChart(page){

	var server = $('#SelectServer').val();
	var range = $('#SelectTimeFrame').val();
	var stat = $('#SelectStat').val();
	
	$.ajax({
		type: "GET",
		url: 'get_table.php',
		data: "server=" + server + "&range=" + range + "&stat=" + stat + "&page=" + page,
		success: function(data) {
			$('#LeaderBoard').html(data);
		}
	});
	
}
